<?php

$url = 'http://localhost/api/login/account';  // 用户端登录接口
$data = [
    'account' => '13800460927',  // 替换为实际的手机号
    'password' => '123456',      // 替换为实际的密码
    'terminal' => 2,             // 添加终端参数：1-h5，2-pc，3-微信小程序，4-安卓，5-ios
    'scene' => 1,                // 添加场景参数：1-账号，2-mobile
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);

if ($result['code'] === 1) {
    echo "登录成功！\n";
    echo "Token: " . $result['data']['token'] . "\n";
    echo "用户信息：\n";
    echo json_encode($result['data'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n";
} else {
    echo "登录失败：" . $result['msg'] . "\n";
} 